﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ConnectToDatabase;
using ConnectToDatabase.Model;

namespace QLGiayDep.Forms
{
    /// <summary>
    /// Interaction logic for FormThongTinNhanVien.xaml
    /// </summary>
    public partial class FormThongTinNhanVien : Page
    {
        SelectDB selectDB;
        string URL;
        public FormThongTinNhanVien()
        {
            InitializeComponent();
        }

        public FormThongTinNhanVien(string m_sMaUser, string _URL)
        {
            InitializeComponent();
            URL = _URL;
            selectDB = (SelectDB)Activator.GetObject(typeof(SelectDB), URL + "SELECTDB_OBJECT");
            if (m_sMaUser == "admin")
            {
                txtMaLoaiNV.Text = "admin";
                txtMaNV.Text = "admin";
                txtTenNV.Text = "admin";
                txtTenLoaiNVNV.Text = "admin";
            }
            else
            {
                NhanVien m_nhanVien = new NhanVien();
                m_nhanVien = selectDB.SelectNhanVien_MaNV(m_sMaUser);
                txtMaLoaiNV.Text = m_nhanVien.MaLoaiNhanVien;
                txtMaNV.Text = m_nhanVien.MaNhanVien;
                txtTenNV.Text = m_nhanVien.TenNhanVien;
                txtTenLoaiNVNV.Text = selectDB.SelectTenLoaiNV(m_nhanVien.MaLoaiNhanVien);
            }
        }

    }
}
